-- local autocmd = vim.api.nvim_create_autocmd

-- Auto resize panes when resizing nvim window
-- autocmd("VimResized", {
--   pattern = "*",
--   command = "tabdo wincmd =",
-- })
--lazygit
local _lazygit = nil
_G._toggle_lazygit = function()
  if vim.fn.executable "lazygit" == 1 then
    if not _lazygit then
      _lazygit = require("toggleterm.terminal").Terminal:new {
        cmd = "lazygit",
        direction = "float",
        close_on_exit = true,
        hidden = true,
      }
    end
    _lazygit:toggle()
  else
    vim.notify("Command [lazygit] not found!", vim.log.levels.ERROR, { title = "toggleterm.nvim" })
  end
end
vim.cmd "hi IlluminatedWordRead guibg=#525456"
vim.cmd "hi IlluminatedWordText guibg=#525456"
vim.cmd "hi IlluminatedWordWrite guibg=#525456"

-- 自动保存文件间隔（以毫秒为单位）
vim.api.nvim_set_option("updatetime", 300)
-- close sawp file
vim.api.nvim_set_option("swapfile", false)
-- auto-save
require "custom.configs.auto-save"
